import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { PositionSelectPanel } from "./PositionSelectPanel";
import { FinalMatchPanel } from "./FinalMatchPanel";
import { SArenaCrossChooseFinalPos } from "../../../../../Message/Public/SArenaCrossChooseFinalPos";
import { SArenaCrossFinalBattles } from "../../../../../Message/Public/SArenaCrossFinalBattles";
import { SArenaCrossGroupBattleEnd } from "../../../../../Message/Public/SArenaCrossGroupBattleEnd";
import { FinalTabletPanel } from "./FinalTabletPanel";
//class ArenaCrossFinalMainWindow
    
    export  class ArenaCrossFinalMainWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(838, 555);
            titleHeight = 26;
            title = Language.getString(44364);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 37, 804, 505, this);
            this._positionSelectPanel = new PositionSelectPanel();
            this._positionSelectPanel.x = 17;
            this._positionSelectPanel.y = 37;
            this.addChild(this._positionSelectPanel);
            this._matchPanel = new FinalMatchPanel();
            this._matchPanel.x = 17;
            this._matchPanel.y = 37;
            this._currentPanel = this._positionSelectPanel;
            return;
        }

        public updateFinalPos(arg1: SArenaCrossChooseFinalPos): void
        {
            this._positionSelectPanel.updateFinalPos(arg1);
            return;
        }

        public updateFinalBattles(arg1: SArenaCrossFinalBattles): void
        {
            this._matchPanel.updateFinalBattles(arg1);
            return;
        }

        public updateBattleEnd(arg1: SArenaCrossGroupBattleEnd): void
        {
            this._matchPanel.updateBattleEnd(arg1);
            return;
        }

        public updateTablet(arg1: SArenaCrossFinalBattles): void
        {
            this.finalTabletPanl.updateFinalBattles(arg1);
            return;
        }

        public changeMatchPanel(): void
        {
            this.changeToPanel(this._matchPanel);
            return;
        }

        public changeSelectPanel(): void
        {
            this.changeToPanel(this._positionSelectPanel);
            return;
        }

        public changeTabletPanl(): void
        {
            this.changeToPanel(this.finalTabletPanl);
            return;
        }

        protected changeToPanel(arg1: Object /* flash.display.Sprite */): void
        {
            if (this._currentPanel == arg1) 
            {
                return;
            }
            if (this._currentPanel && this._currentPanel.parent) 
            {
                this._currentPanel.parent.removeChild(this._currentPanel);
            }
            this.addChild(arg1);
            this._currentPanel = arg1;
            return;
        }

        public get finalTabletPanl(): FinalTabletPanel
        {
            if (!this._tabletPanel) 
            {
                this._tabletPanel = new FinalTabletPanel();
                this._tabletPanel.x = 17;
                this._tabletPanel.y = 37;
            }
            return this._tabletPanel;
        }

        /* internal */ /* var */_positionSelectPanel: PositionSelectPanel;

        /* internal */ /* var */_matchPanel: FinalMatchPanel;

        /* internal */ /* var */_tabletPanel: FinalTabletPanel;

        /* internal */ /* var */_currentPanel: Object /* flash.display.Sprite */;
    }
